<!--
 * @Author: xuzehan 123@qq.com
 * @Date: 2023-04-27 15:08:53
 * @LastEditors: xuzehan 123@qq.com
 * @LastEditTime: 2023-06-01 17:02:44
 * @FilePath: \ant-design-vue-jeecg-master\src\views\taskManagement\modules\createInstruct.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <a-modal v-model="visible" title="生成指令" @ok="handleOk" okText="发送" cancelText="保存">
    <!-- <a-form-model>
      <a-form-model-item label="">
        <span slot="label"><i class="icon-i"></i> </span>
        <a-select v-model="form.region" placeholder="请选择">
          <a-select-option value="shanghai"> Zone one </a-select-option>
          <a-select-option value="beijing"> Zone two </a-select-option>
        </a-select>
      </a-form-model-item></a-form-model
    >
    <a-descriptions title="" :column="1">
      <a-descriptions-item label="星指上行链路工作频点">F1 </a-descriptions-item>
      <a-descriptions-item label="星指上行链路工作频点">F2 </a-descriptions-item>
      <a-descriptions-item label="时隙"> 1，2，3，4 </a-descriptions-item>
      <a-descriptions-item label="星弹下行链路工作频点"> 1，2，3，4 </a-descriptions-item>
      <a-descriptions-item label="星弹下行链路工作速率"> 32kbps </a-descriptions-item>
    </a-descriptions> -->
    <a-descriptions title="" :column="1">
      <a-descriptions-item label="作战开始时间">{{ data.date[0] ? data.date[0] : '/' }} </a-descriptions-item>
      <a-descriptions-item label="作战结束时间">{{ data.date[1] ? data.date[1] : '/' }} </a-descriptions-item>
      <a-descriptions-item label="指控车"> {{ format(data.das) }} </a-descriptions-item>
    </a-descriptions>
  </a-modal>
</template>

<script>
export default {
  data() {
    return {
      visible: false,
      labelCol: { span: 8 },
      wrapperCol: { span: 14 },
      data: { date: [], das: [] },
      form: {
        name: '',
        region: undefined,
        date1: undefined,
        delivery: false,
        type: [],
        resource: '',
        desc: '',
      },
    }
  },
  methods: {
    onSubmit() {
      console.log('submit!', this.form)
    },
    showModal(val) {
      this.visible = true
      this.data = val
      console.log(val)
    },
    handleOk(e) {
      console.log(e)
      this.visible = false
    },
    format(val) {
      let a = []
      val.forEach((el) => {
        console.log(el, '---')
        if (a.find((i) => i.label == el[0])) {
          a.find((i) => i.label == el[0]).car.push(el[1])
        } else {
          a.push({ label: el[0], car: [el[1]] })
        }
      })
      let str = ''
      a.forEach((item) => {
        str += `${item.label}:${item.car.join()}  ，`
      })
      return str
    },
  },
}
</script>

<style></style>
